﻿using System;

namespace DotNetClient
{
    public class HandshakeService
    {
        private Protocol _protocol;
        private Action _callback;

        public const string Version = "0.0.1";
        public const string Type = "unity-socket";

        public HandshakeService(Protocol protocol)
        {
            _protocol = protocol;
        }

        public void request(Action callback)
        {
            _protocol.send(PackageType.PKG_HANDSHAKE);
            _callback = callback;
        }

        internal void invokeCallback(Message_Handshake data)
        {
            // Invoke the handshake callback
            _callback?.Invoke();
        }

        public void ack()
        {
            //_protocol.send(PackageType.PKG_HANDSHAKE_ACK);
        }

        private void buildMsg(Object user)
        {
            // Build sys option
            //sys["version"] = Version;
            //sys["type"] = Type;

            // Build handshake message
            //msg["sys"] = sys;
            //msg["user"] = user;
        }
    }
}
